﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MyLocalChurch.Business;

namespace MyLocalChurch.KidsChurch.Reports
{
    public partial class Default : System.Web.UI.Page
    {
        private readonly MyContext _context = MyContextSingleton.Instance;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
                return;

            var summary = ReportManager.RetrieveReportSummary(_context);

            rptSummary.DataSource = summary.Rows;
            rptSummary.DataBind();

            lblTotalToddler.Text = summary.TotalToddler.ToString();
            lblTotalToddlerCheckedOut.Text = summary.TotalToddler.ToString();
            lblTotalPreSchool.Text = summary.TotalPreSchool.ToString();
            lblTotalPreSchoolCheckedOut.Text = summary.TotalPreSchoolCheckedOut.ToString();
            lblTotalPrimary.Text = summary.TotalPrimary.ToString();
            lblTotalPrimaryCheckedOut.Text = summary.TotalPrimaryCheckedOut.ToString();
            lblTotalPreTeen.Text = summary.TotalPreTeen.ToString();
            lblTotalPreTeenCheckedOut.Text = summary.TotalPreTeenCheckedOut.ToString();
            lblGrandTotal.Text = summary.GrandTotal.ToString();
            lblGrandTotalCheckedOut.Text = summary.GrandTotalCheckedOut.ToString();
        }
    }
}